package cn.com.lsjz.nursemanager.repository.system;

import java.util.List;

import org.springframework.data.jpa.repository.Query;

import cn.com.lsjz.commons.repository.base.BaseRepository;
import cn.com.lsjz.nursemanager.model.system.SysRole;


public interface SysRoleRepository extends BaseRepository<SysRole, Integer>{

	/**
	 * 根据用户ID回去对应的权限信息
	 * @param userId
	 * @return
	 */
	@Query(" select r from SysRole r,SysUserVsRole ur,SysUser u "
			+ " where r.id = ur.roleId and ur.userId = u.userId"
			+ " and u.userId = ?1 order by r.id")
	List<SysRole> loadByUserId(String userId);
	
	
	List<SysRole> getByRoleNameContaining(String roleName);
	
}
